home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Softshoe
/
Lisa's Mac Parts
/
Cursor
/
CursorController.cp
next >
Wrap
Text File
|
2000-06-23
|
2KB
|
83 lines
// CursorController.cp
#ifndef CursorController_h
#include "CursorController.h"
#endif
#ifndef UserState_h
#include "UserState.h"
#endif
#ifndef CursorObject_h
#include "CursorObject.h"
#endif
#ifndef CellCursorCollector_h
#include "CellCursorCollector.h"
#endif
#ifndef WindowObject_h
#include "WindowObject.h"
#endif
#ifndef MouseEvent_h
#include "MouseEvent.h"
#endif
#ifndef Application_h
#include "Application.h"
#endif
#ifndef AbstractWindow_h
#include "AbstractWindow.h"
#endif
CursorController::CursorController()
: current( &CursorObject::Arrow() ),
watchShowing( false ),
userStateChanged( UserState::The(), *this, &MouseWatcher::Invalidate )
{
}
CursorController& CursorController::The()
{
static CursorController the;
return the;
}
void CursorController::MouseMoved( const MouseEvent& event,
RegionObject& sleep )
{
const CursorObject *desired = 0;
WindowObject *window = WindowObject::Front();
if ( window == 0 )
{
desired = &CursorObject::Arrow();
sleep = Rectangle::big;
}
else
if ( window->StructureRegion().Contains( event.GlobalPoint() )
&& window->ContentRegion().Contains( event.GlobalPoint() ) )
{
desired = &Application::The().LocateWindow( *window ).Cursor( event, sleep );
Assert( sleep.Contains( event.GlobalPoint() ) );
}
else
{
desired = &CursorObject::Arrow();
sleep = Rectangle::big;
sleep -= window->ContentRegion();
}
if ( watchShowing || current != desired )
{
watchShowing = false;
current = desired;
current->Show();
}
}
void CursorController::ShowWatch()
{
if ( watchShowing )
return;
Invalidate();
CursorObject::Watch().Show();
}